package com.lianqi.emcpframework.shiro.cas.condition;


import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.util.StringUtils;

/**
 * @program emcp-portal
 * @ClassName CasRestFormCondition
 * @description: 判断是否初始化casRestFormClient
 * @author: sky
 * @create: 2019/05/16 18:45
 */
public class CasRestFormCondition implements Condition {

    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        Environment environment = context.getEnvironment();
        String property =  environment.getProperty("emcp.sso.cas.cas-clients");
        return (!StringUtils.isEmpty(property)) && property.contains("rest");
    }
}
